home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / sample code / graphics 3d / ravecontextsample / source / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  2.1 KB  |  111 lines

  1. /****************************/
  2. /*  RAVE CONTEXT TEST       */
  3. /* By Brian Greenstone      */
  4. /****************************/
  5.  
  6.  
  7. /****************************/
  8. /*    EXTERNALS             */
  9. /****************************/
  10. #include <Fonts.h>
  11. #include <Gestalt.h>
  12.  
  13. #include <Rave.h>
  14. #include <QD3D.h>
  15. #include <QD3DGeometry.h>
  16.  
  17. #include "myglobals.h"
  18. #include "qd3d_support.h"
  19. #include "mymenus.h"
  20. #include "myevents.h"
  21. #include "misc.h"
  22. #include "3dmf.h"
  23. #include "process.h"
  24.  
  25. extern    QD3DSetupOutputType        gModelViewInfo;
  26.  
  27. /****************************/
  28. /*    PROTOTYPES            */
  29. /****************************/
  30.  
  31. static    void ToolBoxInit(void);
  32.  
  33.  
  34. /*****************/
  35. /* TOOLBOX INIT  */
  36. /*****************/
  37.  
  38. static void ToolBoxInit(void)
  39. {
  40. TQ3Status    myStatus;
  41. long response;
  42.  
  43.      MaxApplZone();
  44.     InitGraf(&qd.thePort);
  45.     FlushEvents ( everyEvent, REMOVE_ALL_EVENTS);
  46.     InitFonts();
  47.     InitWindows();
  48.     InitDialogs(nil);
  49.     InitCursor();
  50.     InitMenus();
  51.     TEInit();
  52.     
  53.             /* SEE IF QD3D AVAILABLE */
  54.     
  55.     if((void *)Q3Initialize == (void *)kUnresolvedCFragSymbolAddress)
  56.         DoFatalAlert("\pQuickDraw 3D version 1.6 or better is required to run this application!");
  57.  
  58.     myStatus = Q3Initialize();
  59.     if ( myStatus == kQ3Failure )
  60.         DoFatalAlert("\pQ3Initialize returned failure.");    
  61.         
  62.     Gestalt(gestaltQD3D, &response);
  63.     if (response & (1<<gestaltQD3DPresent))
  64.     {    
  65.         Gestalt(gestaltQD3DVersion,&response);
  66.         if (response < 0x10600)                        // must be using 1.6 or better
  67.         {
  68. err:        
  69.             DoFatalAlert("\pQuickDraw 3D version 1.6 or better is required to run this application!");
  70.         }
  71.     }
  72.     else
  73.         goto err;
  74. }
  75.  
  76.  
  77.  
  78. /*****************/
  79. /* TOOLBOX EXIT  */
  80. /*****************/
  81.  
  82. static void ToolBoxExit(void)
  83. {
  84. TQ3Status    myStatus;
  85.  
  86.     myStatus = Q3Exit();
  87.     if ( myStatus == kQ3Failure )
  88.         DoFatalAlert("\pQ3Exit returned failure.");                
  89. }
  90.  
  91.  
  92. /************************************************************/
  93. /******************** PROGRAM MAIN ENTRY  *******************/
  94. /************************************************************/
  95.  
  96.  
  97. void main(void)
  98. {
  99.     ToolBoxInit();                  
  100.     InitMenuBar();
  101.     InitTest();
  102.  
  103.     while (true)
  104.         HandleEvents();
  105.  
  106.     ToolBoxExit();
  107. }
  108.  
  109.  
  110.  
  111.